home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 August: Tool Chest / Dev.CD Aug 94.toast / Tool Chest / Developer Utilities / Installer 4.0GM SDK / Script Examples / PowerPC⁄68K App Install / NotPPC / NotPPC.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-10  |  1.3 KB  |  56 lines  |  [TEXT/MPS ]

  1. /*
  2.  
  3.     NotPPC.c
  4.  
  5.         Source code for NotPPC application
  6.  
  7. */
  8.  
  9. #include <dialogs.h>
  10. #include <QuickDraw.h>
  11. #include <Dialogs.h>
  12. #include <Windows.h>
  13. #include <Resources.h>
  14. #include <Memory.h>
  15. #include "NotPPC.h"
  16.  
  17.  
  18. void main ()
  19. {
  20.     short        itemHit;
  21.     AlertTHndl    theAlertTemplate;
  22.     Handle        theDITLHandle;
  23.     Handle        theMessageHandle;
  24.     Boolean        canAlert;
  25.  
  26.     InitGraf ((Ptr)&qd.thePort);
  27.     InitWindows ();
  28.     InitDialogs (NULL);
  29.  
  30.     /* set cursor to an arrow */
  31.     SetCursor (&qd.arrow);
  32.  
  33.     /* pre-flight everything first */
  34.     theAlertTemplate = (AlertTHndl)GetResource ('ALRT', RESOURCE_ID);        /* is the ALRT resource around? */
  35.     theDITLHandle = GetResource ('DITL', (*theAlertTemplate)->itemsID);        /* how about the DITL? */
  36.     theMessageHandle = GetResource ('STR ', RESOURCE_ID);                    /* check the STR resource, too */
  37.  
  38.     CouldAlert (RESOURCE_ID);                                                /* is there enough memory to handle the alert? */
  39.     canAlert = (ResError() == noErr) && (MemError() == noErr);
  40.     FreeAlert (RESOURCE_ID);                                                /* free the memory */
  41.  
  42.     if ((theAlertTemplate) || (theDITLHandle) || (theMessageHandle) || (canAlert))
  43.     {
  44.         /* Success at last... */
  45.         ParamText (*(theMessageHandle), "", "", "");                        /* use the loaded STR resource to replace ^0 in alert's DITL */
  46.         itemHit = Alert (RESOURCE_ID, nil);                                    /* run the alert */
  47.     }
  48.     else
  49.     {
  50.         /* give some indication we're hosed... */
  51.         SysBeep(2); 
  52.     }
  53. }
  54.  
  55.  
  56.